package org.epidroid.epidroid.chronos.ui;

import org.epidroid.epidroid.R;
import org.epidroid.epidroid.chronos.engine.Chronos;
import org.epidroid.epidroid.chronos.engine.objects.ChronosNode;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class ChronosActivity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.chronos);

		Resources res = getResources();
		TabHost tabHost = getTabHost();
		TabHost.TabSpec spec = null;
		Intent intent;

		// Adding tab "Today"
		intent = new Intent().setClass(this, ChronosCompactViewActivity.class);
		spec = tabHost.newTabSpec("today").setIndicator("Today")
				.setContent(intent);
		tabHost.addTab(spec);

		// Adding tab "Favorite Groups"
		intent = new Intent().setClass(this, ChronosFavActivity.class);
		spec = tabHost.newTabSpec("favorites").setIndicator("My favorites")
				.setContent(intent);
		tabHost.addTab(spec);

		// Adding tab "All groups"
		intent = new Intent().setClass(this, ChronosAllGroupsActivity.class);
		spec = tabHost.newTabSpec("all").setIndicator("All").setContent(intent);
		tabHost.addTab(spec);

		// Automatically select favorite groups tab
		tabHost.setCurrentTab(0);
	}

	private void testGetMenu() {
		Chronos chronos = new Chronos();
		ChronosNode root = chronos.getMenu("trainnees");

		if (null != root)
			root.print();
	}

	private void launchCalendar() {
		startActivity(new Intent(this, ChronosViewActivity.class));
	}

}
